/**
 * @Description:
 * @Author ZhangYu
 * @Date 2019-12-06 14:43:18
 */
/**
 * 字符串反序列为对象
 * @param str
 */
export let parse = function (str) {
  let obj = {};
  str.replace(/([^&=]*)=([^&=]*)/g,function () {
    obj[arguments[1]] = arguments[2];
  });
  return obj;
}

/**
 * 对象的序列化
 * @param obj
 * @returns {string}
 */
export let stringify = (obj) =>{
  let arr = [];
  for (let key in obj){
    arr.push(`${key}=${obj[key]}`);
  }
  return arr.join('&');
}